import request from '@/utils/request'

// 查询生产工单列表
export function listTickets(query) {
  return request({
    url: '/storage/tickets/list',
    method: 'get',
    params: query
  })
}

// 查询生产工单详细
export function getTickets(ticketsId) {
  return request({
    url: '/storage/tickets/' + ticketsId,
    method: 'get'
  })
}

// 新增生产工单
export function addTickets(data) {
  return request({
    url: '/storage/tickets',
    method: 'post',
    data: data
  })
}

// 修改生产工单
export function updateTickets(data) {
  return request({
    url: '/storage/tickets',
    method: 'put',
    data: data
  })
}

// 删除生产工单
export function delTickets(ticketsId) {
  return request({
    url: '/storage/tickets/' + ticketsId,
    method: 'delete'
  })
}
//审核/反审核生产工单
export function updateAudit(ticketsId) {
  return request({
    url: '/storage/tickets/audit/' + ticketsId,
    method: 'put'
  })
}
//结案/反结案生产工单
export function updateClose(ticketsId) {
  return request({
    url: '/storage/tickets/close/' + ticketsId,
    method: 'put'
  })
}
//查询未打印的数量
export function getBicycleUnPrintNumber(ticketsId) {
  return request({
    url: '/storage/tickets/unprintnumber/' + ticketsId,
    method: 'get'
  })
}
//生成并打印车辆
export function addBicycleByTicketsId(data) {
  return request({
    url: '/storage/tickets/bicycle',
    method: 'post',
    data: data
  })
}
//获取车辆ID
export function getBicycle(ticketsId) {
  return request({
    url: '/storage/tickets/bicycle/' + ticketsId,
    method: 'get'
  })
}
//分配产品线
export function updateTicketsByproductLine(data) {
  return request({
    url: '/storage/tickets/productLine',
    method: 'put',
    data: data
  })
}
//补打车辆ID
export function insertBicycle(data) {
  return request({
    url: '/storage/tickets/Clearing',
    method: 'post',
    data: data
  })
}